<?php
include('db_connect.php');
$id= $_GET['bannerdata'];
$sql="SELECT * FROM tbl_banner_img where imgID=".$id." ";
$result = mysql_query($sql);

while($row = mysql_fetch_array($result)){
	$img = $row['imgName'];
	$title = $row['title'];
	$content = $row['content'];
	
}
?>

<script>

$("#update").click(function() {
	
	
	var title = $("#bannertitle");
	var content = $("#bannercontent");
	var type = "edit";
		
	
	$.ajax({
		url:"admin/editBannerData.php?id="+<?php echo $id; ?>+"&title="+title.val()+"&content="+content.val()+"&type="+type,
		success:function(data){
			//$( "#msgbox" ).html(data);
			//$( "#msgbox" ).dialog();
				alert("successfully updated");
				//$( this).dialog( "close" );
				$("#banner_load").load("admin/banner_data_admin.php");
			
			
			
		}
	
	});
	
});

$("#cancel").click(function(){
	location.reload();
})


</script>
<div id="editbanner" width="100%">
	<table border="0">
		<tr>
			<td colspan="2"><img align="center" src="images/<?php echo $img; ?> " style="width:300px; height:120px; margin-left:auto; margin-right:auto;"></td>
		<tr>
		<tr>
			<td><label>Title</label></td>
			<td>
				<input type="text" value="<?php echo $title;?>" id="bannertitle"/> 
			</td>
		</tr>
		<tr>
			<td valign="top"><label>Content</label></td>
			<td>
				<textarea id="bannercontent" style="width:610px; height:300px;"><?php echo trim($content);?></textarea>
			</td>
		</tr>
		<tr>
			<td colspan="2" ><button id="update">Update</button><button id="cancel">Cancel</button></td>
			
		</tr>
	</table>


	
	<br>

</div>